import { useState } from 'react';

interface AsyncState<D> {
    loading: boolean;
    data?: D;
    error?: unknown;
}
export default function useAsync<D>() {
    const [state, setState] = useState<AsyncState<D>>({ loading: false });
    return [state, setState] as const;
}
